package org.kotboot.kit

import org.apache.commons.lang3.StringUtils
import org.kotboot.cons.ConsRegx

class Kit{
    companion object {
        fun notJwtcode(code: String?):Boolean {
            if(isNull(code)) return true
            return !ConsRegx.jwtcode.matcher(code).find()
        }

        fun encryptMobile(mobile: String): String? {
            return if (K.isEmpty(mobile)) {
                mobile
            } else StringUtils.replacePattern(mobile, "^(\\d{3}).*(\\d{4})$", "$1****$2")
        }
    }
}

fun isNull(obj:Any?):Boolean = obj == null
fun notNull(obj:Any?):Boolean = obj != null
fun judgeMobile(mobile: String?):Boolean{
    return when(mobile){
        null,"" -> false
        else -> mobile.matches(Regex("^1\\d{10}$"))
    }
}


